package cn.db101.gocentdaily.service.impl;

import cn.db101.gocentdaily.mapper.SysUserMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.db101.gocentdaily.entity.SysUser;
import cn.db101.gocentdaily.service.SysUserService;
import org.springframework.stereotype.Service;

/**
 * @author win
 * @description 针对表【sys_user(用户表)】的数据库操作Service实现
 * @createDate 2024-06-02 02:11:07
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
        implements SysUserService {

    /**
     * 登录
     *
     * @param username
     * @param password
     * @return
     */
    @Override
    public boolean login(String username, String password) {

        SysUser sysUser = this.getOne(new LambdaQueryWrapper<SysUser>()
                .eq(SysUser::getUsername, username));
        if (sysUser == null) {
            return false;
        }
        if (!sysUser.getPassword().equals(password)) {
            return false;
        }
        return true;
    }

}




